//
//  ViewController.m
//  tableViewDemo
//
//  Created by lix on 16/8/25.
//  Copyright © 2016年 lix. All rights reserved.
//

#import "ViewController.h"
#import "ReuseCtr.h"
#import "AdaptCtr.h"

@interface ViewController ()

@end

@implementation ViewController

- (id)init{
    if (self = [super init]) {
        
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    //创建button
    [self initButton];
}

- (void)initButton{
    NSArray * array = @[@"重用",@"自适应",@""];
    
    for (int i = 0; i<3; i++) {
        UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.tag = i;
        button.frame = CGRectMake(70, 150+80*i, 235, 40);
        [button setTitle:array[i] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
        [button addTarget:self action:@selector(pushView:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
    }
    
}

- (void)pushView:(UIButton *)but{
    long buttonTag = (long)but.tag;
    
    if (buttonTag == 0) {
        ReuseCtr * rvc = [[ReuseCtr alloc]init];
        [self.navigationController pushViewController:rvc animated:NO];
    }
    else if (buttonTag == 1){
        AdaptCtr * avc = [[AdaptCtr alloc]init];
        [self.navigationController pushViewController:avc animated:NO];
    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
